<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ajax文件上传</title>
</head>

<body>
<form id="J_myUploadForm" action="" method="post" enctype="multipart/form-data">
  <input type="file" name="fileField" id="fileField" />
</form>
<input type="button" value="ajaxFileUpload" id="btn"/>
<script src="ajaxFileUpload.js"></script>
<script>
var btn = document.getElementById('btn');
btn.onclick = function(){
    ajaxFileUpload({
        id:'fileField',
        callback:function(){
                var src = this.responseText;
                var img = document.createElement('img');
                img.src = src;
                document.body.appendChild(img);
        }
    });    
}
</script>
</body>
</html>